package com.eastfair.home.controller;

/**
 * @Author suolong
 * @Date 2022/8/8 20:58
 */

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.eastfair.annotation.annotation.log.SysLog;
import com.eastfair.boot.request.PageParams;
import com.eastfair.core.base.R;
import com.eastfair.home.service.HomeServiceInventoryService;
import com.eastfair.home.service.SpecsService;
import com.eastfair.venueservice.dto.*;
import com.eastfair.venueservice.vo.ServiceInventoryInFlowVO;
import com.eastfair.venueservice.vo.ServiceInventoryOutFlowVO;
import com.eastfair.venueservice.vo.ServiceInventoryVO;
import com.eastfair.venueservice.vo.ServiceSpecsVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * 主场服务库存
 * </p>
 *
 * @author lyw
 * @date 2022-08-08
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/homeServiceInventory")
@Api(value = "homeServiceInventory", tags = "主场服务库存")
public class HomeServiceInventoryController {

    @Resource
    private HomeServiceInventoryService homeServiceInventoryService;

    /**
     * 插入入库流水
     *
     * @param serviceInventoryInFlowDTO
     * @return R<Boolean>
     */
    @ApiOperation(value = "插入入库流水")
    @SysLog("服务入库")
    @PostMapping(value = "/saveInFlow")
    public R<Boolean> saveInFlow(@RequestBody ServiceInventoryInFlowDTO serviceInventoryInFlowDTO){
        log.info("saveInFlow - 插入入库流水 serviceInventoryInFlowDTO={}", serviceInventoryInFlowDTO);
        return homeServiceInventoryService.saveInFlow(serviceInventoryInFlowDTO);
    }

    /**
     * 插入出库流水
     *
     * @param serviceInventoryOutFlowDTO
     * @return R<Boolean>
     */
    @ApiOperation(value = "插入出库流水")
    @SysLog("服务出库")
    @PostMapping(value = "/saveOutFlow")
    public R<Boolean> saveOutFlow(@RequestBody ServiceInventoryOutFlowDTO serviceInventoryOutFlowDTO){
        log.info("saveOutFlow - 插入入库流水 serviceInventoryOutFlowDTO={}", serviceInventoryOutFlowDTO);
        return homeServiceInventoryService.saveOutFlow(serviceInventoryOutFlowDTO);
    }

    /**
     * 查询库存列表
     * @param serviceInventoryQuery
     * @return
     */
    @ApiOperation(value = "查询库存列表")
    @PostMapping(value = "/queryInventoryList")
    public R<Page<ServiceInventoryVO>> queryInventoryList(@RequestBody PageParams<ServiceInventoryQuery> serviceInventoryQuery){
        log.info("queryInventoryList - 插入入库流水 serviceInventoryQuery={}", serviceInventoryQuery);
        return homeServiceInventoryService.queryInventoryList(serviceInventoryQuery);
    }

    /**
     * 查询入库记录
     * @param serviceInventoryQuery
     * @return
     */
    @ApiOperation(value = "查询入库记录")
    @PostMapping(value = "/queryInFlowList")
    public R<Page<ServiceInventoryInFlowVO>> queryInFlowList(@RequestBody PageParams<ServiceInventoryInFlowQuery> serviceInventoryQuery){
        log.info("queryInFlowList - 插入入库流水 serviceInventoryQuery={}", serviceInventoryQuery);
        return homeServiceInventoryService.queryInFlowList(serviceInventoryQuery);
    }

    /**
     * 查询出库记录
     * @param serviceInventoryOutFlowQuery
     * @return
     */
    @ApiOperation(value = "查询出库记录")
    @PostMapping(value = "/queryOutFlowList")
    public R<Page<ServiceInventoryOutFlowVO>> queryOutFlowList(@RequestBody PageParams<ServiceInventoryOutFlowQuery> serviceInventoryOutFlowQuery){
        log.info("queryOutFlowList - 插入入库流水 serviceInventoryOutFlowQuery={}", serviceInventoryOutFlowQuery);
        return homeServiceInventoryService.queryOutFlowList(serviceInventoryOutFlowQuery);
    }

}
